<?php
include_once "db.php";
include_once "checksession.php"; 
include_once "auth_permissions.php"; 
authorize("user");

$browsers = mysql_query("select * from browser_type WHERE status = '0'");
$computer = mysql_query("select * from computer_type WHERE status = '0'");
$problem = mysql_query("select * from problem_type WHERE status = '0'");
$os = mysql_query("select * from operating_system WHERE status = '0'");
$courses = mysql_query("select * from current_courses");

// if the form brought back an error, auto fill out the area of the form that was not empty.
if (isset($_GET['f_name']) && $_GET['f_name'] != 'error') $first_name = $_GET['f_name'] ? $_GET['f_name'] : null;
if (isset($_GET['email']) && $_GET['email'] != 'error') $email = $_GET['email'] ? $_GET['email'] : null;
if (isset($_GET['l_name']) && $_GET['l_name'] != 'error') $last_name = $_GET['l_name'] ? $_GET['l_name'] : null;
if (isset($_GET['Problem']) && $_GET['Problem'] != 'error') $problem_notes = $_GET['Problem'] ? $_GET['Problem'] : null;
if (isset($_GET['notes']) && $_GET['notes'] != 'error') $notes = $_GET['notes'] ? $_GET['notes'] : null;
if (isset($_GET['course']) && $_GET['course'] != 'error') $course = $_GET['course'] ? $_GET['course'] : null;
if (isset($_GET['userid']) && $_GET['userid'] != 'error') $usersid = $_GET['userid'] ? $_GET['userid'] : null;
//$pipeline_reset = $_GET['pipeline_reset'];
//$pipeline_reset2 = $_GET['pipeline_reset'];
//if($pipeline_reset =="1"){$checked ="checked=checked";}
//else{$checked =="";} 
//if($pipeline_reset2 =="2"){$checked ="checked=checked";}
//else{$checked =="";}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Add a new Entry</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="meta-style.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
</head>

<body>

<?php
include_once "topnav.php";
?>

<FORM action="insert_call.php" METHOD="POST">
	<input type="hidden" name="HDuserID" value="<? echo $_SESSION[ID] ?>">
<?
 if ($_GET[error]) {
  if($_GET[f_name] == "error") {
   print "<p class='error'>Please enter your First Name.</p>";
  }
  if($_GET[l_name] == "error") {
   print "<p class='error'>Please enter your Last Name.</p>";
  } 
    if($_GET[email] == "error") {
   print "<p class='error'>Please enter your Email.</p>";
  }
    if($_GET[Platform] == "error") {
   print "<p class='error'>Please select your Computer Type. If you don't know, select Unknown.</p>";
  }
    if($_GET[browser] == "error") {
   print "<p class='error'>Please enter your Browser Type.  If you don't know, select Unknown.</p>";
  }
  if($_GET[operating_system] == "error") {
   print "<p class='error'>Please enter your Operating System. If you don't know, select Unknown.</p>";
  } 
    //if($_GET[course] == "error") {
  // print "<p class='error'>Please enter your Course.  If you don't have one, select the blank option in the drop down menu.</p>";
 // }
   if($_GET[problem_type] == "error") {
   print "<p class='error'>Please select your Problem Type. If you don't know, select Other.</p>";
  }
   if($_GET[pipeline_reset] == "error") {
   print "<p class='error'>Please note whether you reset the user's Pipeline account.</p>";
  }
   //if($_GET[vista_reset] == "error") {
   //print "<p class='error'>Please note whether you reset the user's Vista account.</p>";
  //}
   if($_GET[Problem] == "error") {
   print "<p class='error'>Please enter information about the student's problem.</p>";
  }
  
   if($_GET[notes] == "error") {
   print "<p class='error'>Please enter information about the how you assisted the student.</p>";
  }
  
   if($_GET[call_closed] == "error") {
   print "<p class='error'>Please choose Yes or No to open/close this call.</p>";
  }
  
 }
?>
   <table width="800" BORDER=1 cellpadding=5 cellspacing=0 bordercolor="#006699" background="#CCCCCC" align="center" >
    <tr align="left" valign="top">
      <td colspan="2" bordercolor="#006699" bgcolor="#006699"><font color="white"><span class="style1">Add a New Helpdesk Entry</span></td>
    </tr>
	<tr>
	<td colspan="2"><font color="red">* = Required</font></td>
	</tr>
    <tr valign="top">
      <td width="50%" align="right" class="normalblue"><b><font color="#FF0000">*</font>First Name</b></td>
      <td width="50%" align="left"><input name="f_name" type="TEXT" id="f_name" value="<?php echo $first_name; ?>" size="35"></td>
    </tr>
    <tr valign="top">
      <td align="right" class="normalblue"><strong>Middle Initial </strong></td>
      <td align="left"><input name="m_initial" type="TEXT" id="m_initial" value="<?php echo $_GET['m_initial']; ?>" size="35"></td>
    </tr>
    <tr valign="top">
      <td width="50%" align="right" class="normalblue"><b><font color="#FF0000">*</font>Last Name</b></td>
      <td width="50%" align="left"><input name="l_name" type="TEXT" id="l_name" value="<?php echo $last_name; ?>" size="35"></td>
    </tr>
    <tr valign="top">
      <td align="right" class="normalblue"><b>Student ID (K#)</b></td>
      <td align="left"><input name="userid" type="TEXT" id="userid" value="<?php echo $usersid; ?>" size="35"></td>
    </tr>
     <tr valign="top">
       <td width="50%" align="right" class="normalblue"><b>Other Name(s)</b></td>
       <td width="50%" align="left"><input name="o_name" type="TEXT" id="o_name" value="<?php echo $_GET['o_name']; ?>" size="35"></td>
     </tr>
     <tr valign="top">
       <td align="right" class="normalblue"><b><font color="#FF0000">*</font>Birthdate</b></td>
       <td align="left"><input name="birthdate" type="TEXT" id="" value="" size="35" maxlength="30"></td>
     </tr>
     <tr valign="top">
       <td width="50%" align="right" class="normalblue"><b><font color="#FF0000">*</font>Return Email Address</b></td>
       <td width="50%" align="left"><input name="email" type="TEXT" id="email" value="<?php echo $email; ?>" size="35"></td>
     </tr>
     <tr valign="top">
       <td align="right" class="normalblue"><b>Daytime Phone</b></td>
       <td align="left"><input name="dayphone" type="TEXT" id="dayphone" value="<?php echo $_GET['dayphone']; ?>" size=35></td>
     </tr>
     <tr valign="top">
       <td align="right" class="normalblue"><b><font color="#FF0000">*</font>Computer Type</b></td>
       <td align="left"><select name="Platform" size=1 value="">
           <option value="">Select your computer...</option>
           <?php
		 while($computerresults = mysql_fetch_array($computer)) {
		 echo "<option value=\"".$computerresults[CT_ID]."\">".$computerresults[CT_desc]. "</option>\n";
	      }
	     ?>
       </select></td>
     </tr>
     <tr valign="top">
       <td align="right" class="normalblue"><b><font color="#FF0000">*</font>Browser Type</b></td>
       <td align="left"><select  name="browser" size=1 id="browser" value="">
           <option value="">Select a Browser...</option>
           <?php
		 while($browsersresults = mysql_fetch_array($browsers)) {
		 echo "<option value=\"".$browsersresults[BT_ID]."\">".$browsersresults[BT_desc]. "</option>\n";
	      }
	     ?>
       </select></td>
     </tr>
        <tr valign="top">
       <td width="50%" align="right" class="normalblue"><b><font color="#FF0000">*</font>Operating System</b></td>
       <td width="50%" align="left"><select  name="operating_system" size=1 id="operating_system" value="">
         <option value="">Select your Operating System</option>
         <?php
		 while($osresults = mysql_fetch_array($os)) {
		 echo "<option value=\"".$osresults[os_id]."\">".$osresults[os_desc]. "</option>\n";
	      }
	     ?>
       </select></td>
     </tr>
	   <tr valign="top">
       <td width="50%" align="right" class="normalblue"><b><font color="#FF0000">*</font>Problem or Question Category</b></td>
       <td width="50%" align="left"><select  name="problem_type" size=1 id="problem_type" value="<?php if($_GET['problem_type'] != "error") print $_GET['problem_type'];?>">
         <option value="">Select your problem type...</option>
         <?php
		 while($problemresults = mysql_fetch_array($problem)) {
		 echo "<option value=\"".$problemresults[PT_ID]."\">".$problemresults[PT_desc]. "</option>\n";
	      }
	     ?>
       </select></td>
     </tr>
    <tr valign="top">
      <td width="50%" align="right" class="normalblue"><b>Course/CRN #</b></td>
      <td width="50%" align="left"><input name="course" type="TEXT" id="course" value="<?php echo $course; ?>" size="35" maxlength="30"></td>
    </tr>
   <tr valign="top">
      <td align="right" class="normalblue"><b><font color="#FF0000">*</font>Semester</b></td>
      <td align="left" class="normalblue">      
			<input name="semester" type="radio" value="summer2012"> Summer 2012 <br>
			<input name="semester" type="radio" value="spring2012"> Spring 2012 <br>
			<input name="semester" type="radio" value="fall2011"> Fall 2011 </td>
    </tr>
    <tr valign="top">
      <td width="50%" align="right" class="normalblue"><b><font color="#FF0000">*</font>Enter student's problem details here.</b></td>
      <td width="50%" align="left"><span class="normalblue">
        <textarea name="Problem" rows=5 cols=70 wrap="soft" value=""><?php echo $problem_notes; ?></textarea>
      </span></td>
    </tr>
     <tr valign="top">
       <td align="right" class="normalblue"><strong><b><font color="#FF0000">*</font></b>Did you reset user's Pipeline account? </strong></td>
       <td align="left"><input name="pipeline_reset" type="checkbox" id="pipeline_reset"  value="1">
         Yes
           <input name="pipeline_reset2" type="checkbox" id="pipeline_reset2"  value="2">
         No &nbsp;</td>
     </tr>
     <tr valign="top">
       <td width="50%" align="right" class="normalblue"><b>Did student call the online help desk and leave a message about
         this?</b></td>
       <td width="50%" align="left"><input name="call" type="checkbox" value="1">
         Yes
         <input name="call2" checked="checked" type="checkbox" value="2">
         No &nbsp;</td>
     </tr>
     
     <tr valign="top">
       <td width="50%" align="right" class="normalblue"><p><strong><b><font color="#FF0000">*</font></b>Enter information on how you assisted this student here: </strong></p></td>
       <td width="50%" align="left"><span class="normalblue">
         <textarea name="notes" cols=70 rows=5 wrap="soft" id="notes" value=""><?php echo $notes;?></textarea>
       </span></td>
     </tr>
     <tr valign="top">
       <td align="right" class="normalblue"><strong><b><font color="#FF0000">*</font></b>Type of Contact or transfer: </strong></td>
       <td align="left" class="normalblue"><input type="checkbox" name="contact_type" value="email">
Email
<input type="checkbox" name="contact_type" value="phone">
Phone 
<input type="checkbox" name="contact_type" value="in-person">
In-Person 
<input type="checkbox" name="contact_type" value="voicemail">
Voicemail<br>
			Transferred:<br>			
			<input type="checkbox" name="contact_type" value="admissions">Admissions
			<input type="checkbox" name="contact_type" value="counseling">Counseling 
			<input type="checkbox" name="contact_type" value="other">Other Ext. (please specify)
		 </td>
     </tr>
     <tr valign="top">
       <td align="right" class="normalblue"><strong><b><font color="#FF0000">*</font></b>Higher Level Call ?</strong> </td>
       <td align="left" class="normalblue"><input name="high_level" type="radio" value="1">
         Yes
         <input name="high_level" type="radio" value="2" >
         No</td>
     </tr>
	   <tr valign="top">
       <td align="right" class="normalblue"><strong><b><font color="#FF0000">*</font></b>Mark this entry as "Pending" more student information?</strong> </td>
       <td align="left" class="normalblue"><input name="pending" type="radio" value="1">
         Yes
         <input name="pending" type="radio" value="0" >
         No</td>
     </tr>
     <tr valign="top">
       <td align="right" class="normalblue"><strong><b><font color="#FF0000">*</font></b>Call Closed?</strong> </td>
       <td align="left" class="normalblue"><input name="call_closed" type="radio" value="2">
         Yes
         <input name="call_closed" type="radio" value="1" >
         No</td>
     </tr>
     <tr valign="top">
       <td width="50%" align="right" class="normalblue">&nbsp;</td>
       <td width="50%" align="left"><span class="normalblue">
         <input type=SUBMIT value="Submit Call" name="SUBMIT">
       </span></td>
     </tr>
  </table>
</FORM>

   
</body>
</html>
